package com.youdoneed.community.forum.web;

import com.youdoneed.community.common.vo.ResultMessage;
import com.youdoneed.community.forum.dao.ForumallowviewrecordMapper;
import com.youdoneed.community.forum.entity.Forumallowviewrecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by lid on 2017/9/20 0020.
 * 获取隐私设置记录
 */
@RestController
@RequestMapping(value = "/allowViewRecord", method = {RequestMethod.GET, RequestMethod.POST})
@Api(value = "隐私设置控制器", description = "隐私设置模块相关操作")
public class ForumallowviewrecordController {
    private static final Logger logger = LoggerFactory.getLogger(ForumallowviewrecordController.class);

    @Autowired
    private ForumallowviewrecordMapper forumallowviewrecordMapper;

    /**
     * 通过msgId查找帖子隐私设置
     *
     * @param msgId
     * @return ResultMessage
     * @author lid
     * @date 2017.6.30
     */
    @ResponseBody
    @RequestMapping(value = "/getAllowViewRecords", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(notes = "通过msgId查找帖子隐私设置", value = "通过msgId查找帖子隐私设置")
    public ResultMessage<List<Forumallowviewrecord>> getAllowViewRecords(String msgId) {
        return ResultMessage.newSuccess("通过msgId查找帖子隐私设置成功！").setData(forumallowviewrecordMapper.selectByMsgId(msgId));
    }
}
